﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Cofe.Core;
using Cofe.Core.Actions;
using Cofe.IO.Interfaces;

namespace Cofe.IO.Compress
{
    public abstract class CompressionWrapperBase : ICompressorWrapper
    {
        #region Constructor

        #endregion

        #region Methods

        public abstract bool IsArchive(string fileName);
        public abstract byte[] GetEmptyArchiveBytes(string type);
        public abstract Task<bool> TestAsync(Core.StreamContainer container);
        
        protected abstract bool compressMultiple(StreamContainer container, Dictionary<string, System.IO.Stream> streamDic, IProgress<ProgressEventArgs> progress);
        protected abstract bool delete(StreamContainer container, string delPathOrMask);
        protected abstract IEnumerable<List<PropertyPair>> list(StreamContainer container, string pattern, bool listSubdir);
        protected abstract bool exists(StreamContainer container, string pathOrMask, bool isFolder);
        protected abstract bool extractOne(StreamContainer container, string fileName, string password, System.IO.Stream outputStream);        

        public bool ExtractOne(StreamContainer container, string fileName, string password, System.IO.Stream outputStream)
        {
            return extractOne(container, fileName, password, outputStream);
        }
       
        public bool CompressMultiple(StreamContainer container, Dictionary<string, System.IO.Stream> streamDic, IProgress<ProgressEventArgs> progress = null)
        {
            return compressMultiple(container, streamDic, progress);
        }

        public bool Delete(StreamContainer container, string delPathOrMask)
        {
            return delete(container, delPathOrMask);
        }

        public IEnumerable<List<PropertyPair>> List(StreamContainer container, string pattern, bool listSubdir = false)
        {
            return list(container, pattern, listSubdir);
        }


        public bool Exists(StreamContainer container, string pathOrMask, bool isFolder)
        {
            return exists(container, pathOrMask, isFolder);
        }


        #endregion

        #region Data

        #endregion

        #region Public Properties

        #endregion


    }
}
